<?php
	include("../include/init.php");//将配置文件全部加载进来
	include("../include/check_login.php");//登录

	$insert = new sql_class("admin");

	if($_POST){
		
		$data = array(
					"admin_name"=>trim($_POST['admin_name']),
					"admin_pwd"=>md5($_POST['admin_pwd']),
				);
		if($_FILES['admin_img']['size'] > 0){
			$path = DIR."/uploads/";
			$filename = uploads("admin_img",1048576,$path);
			$data['admin_img'] = 'uploads/'.$filename;
		}
		
		$insert_id = $insert->save($data);
		if($insert_id){
			show_msg("添加管理员成功","admin_list.php");
			exit;
		}else{
			show_msg("添加管理员失败","admin_add.php");
			exit;
		}
	}
	


	$smarty->display("admin/admin_add.html");//连接index.html



?>